package com.cy.demo.service;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class MemoryServiceImpl {
    @Cacheable("mykey")
    public List<Map<String,Object>> list(){
        System.out.println("Get Data from Database");
        Map m1=new HashMap();
        m1.put("id",100);
        m1.put("title","title-A");
        Map m2=new HashMap();
        m2.put("id",101);
        m2.put("title","title-B");
        List list=new ArrayList();
        list.add(m1);
        list.add(m2);
        return list;
    }
}
